package com.thx.workfloworguser.model;

import java.util.List;

import com.topdt.jbpm.identity.Department;
import com.topdt.jbpm.identity.User;


/**
 *  @Project       : thx-workflow-orguser
 *  @Program Name  : com.thx.workfloworguser.model.DepartmentImpl.java
 *  @Class Name    : DepartmentImpl
 *  @Description   : 类描述
 *  @Author        : calonlan
 *  @Creation Date : 2015年1月23日 上午11:47:52
 *  @ModificationHistory
 *  Who        When          What
 *  --------   ----------    -----------------------------------
 *  username   2015年1月23日       TODO
 */
public class DepartmentImpl implements Department{

	private com.thx.org.model.Department department;
	private List<DepartmentImpl> children;
	private List<UserImpl> users;

	@Override
	public String getId() {
		return department.getDepId();
	}

	@Override
	public String getName() {
		return department.getDepName();
	}

	@Override
	public String getType() {
		return null;
	}

	@Override
	public int getLevel() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void setChildren(List<? extends Department> children) {
		// TODO Auto-generated method stub
//		department.children = (List<DepartmentImpl>) children;
		this.children = (List<DepartmentImpl>) children;
	}

	@Override
	public List<? extends Department> getChildren() {
		/*List<com.thx.org.model.Department> departments = department.getChildren();
		List depts = new ArrayList();
		DepartmentImpl dept = null;
		for (com.thx.org.model.Department temp : departments) {
			dept = new DepartmentImpl();
			dept.setDepartment(temp);
			depts.add(dept);
		}
		return depts;*/
		return children;
	}

	@Override
	public void setUsers(List<? extends User> users) {
		// TODO Auto-generated method stub
		this.users = (List<UserImpl>) users;
	}

	@Override
	public List<? extends User> getUsers() {
		/*Set<com.thx.user.model.User> set = department.getUsers();
		List users = new ArrayList();
		UserImpl userImpl = null;
		Iterator<com.thx.user.model.User> ite = set.iterator();
		while (ite.hasNext()) {
			userImpl = new UserImpl();
			userImpl.setUser(ite.next());
		}
		return users;*/
		return users;
	}

	public com.thx.org.model.Department getDepartment() {
		return department;
	}

	public void setDepartment(com.thx.org.model.Department department) {
		this.department = department;
	}

	@Override
	public String getParentId() {
		return department.getParentId();
	}




}
